/*
 * Allwinner sun50iw10p1 SoCs clk driver.
 *
 * Copyright(c) 2012-2016 Allwinnertech Co., Ltd.
 * Author: huangshuosheng <huangshuosheng@allwinnertech.com>
 *
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/* the clk table is not right ,please fix me when ic come back */

#include "clk-sun50iw10.h"
struct sunxi_clk_factor_freq factor_pllcpu_tbl[] = {
PLLCPU(41,      0,      0,     1008000000U),
};

/* PLLDDR(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllddr_tbl[] = {
PLLDDR(32,     0,     0,     792000000U),
};

/* PLLPERIPH0(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllperiph0_tbl[] = {
PLLPERIPH0(49,	0,	0,	600000000U),
};

/* PLLPERIPH1(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllperiph1_tbl[] = {
PLLPERIPH1(49,	0,	0,	600000000U),
};

/* PLLGPU(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllgpu_tbl[] = {
PLLGPU(24,     0,     0,     600000000U),
};

/* PLLVIDEO0(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllvideo0x4_tbl[] = {
PLLVIDEO0(23,	1,	288000000U),
PLLVIDEO0(24,	1,	300000000U),
PLLVIDEO0(25,	1,	312000000U),
PLLVIDEO0(26,	1,	324000000U),
PLLVIDEO0(27,	1,	336000000U),
PLLVIDEO0(28,	1,	348000000U),
PLLVIDEO0(29,	1,	360000000U),
PLLVIDEO0(30,	1,	372000000U),
PLLVIDEO0(31,	1,	384000000U),
PLLVIDEO0(32,	1,	396000000U),
PLLVIDEO0(33,	1,	408000000U),
PLLVIDEO0(34,	1,	420000000U),
PLLVIDEO0(35,	1,	432000000U),
PLLVIDEO0(36,	1,	444000000U),
PLLVIDEO0(18,	0,	456000000U),
PLLVIDEO0(38,	1,	468000000U),
PLLVIDEO0(19,	0,	480000000U),
PLLVIDEO0(40,	1,	492000000U),
PLLVIDEO0(20,	0,	504000000U),
PLLVIDEO0(42,	1,	516000000U),
PLLVIDEO0(21,	0,	528000000U),
PLLVIDEO0(44,	1,	540000000U),
PLLVIDEO0(22,	0,	552000000U),
PLLVIDEO0(46,	1,	564000000U),
PLLVIDEO0(23,	0,	576000000U),
PLLVIDEO0(48,	1,	588000000U),
PLLVIDEO0(24,	0,	600000000U),
PLLVIDEO0(50,	1,	612000000U),
PLLVIDEO0(25,	0,	624000000U),
PLLVIDEO0(52,	1,	636000000U),
PLLVIDEO0(26,	0,	648000000U),
PLLVIDEO0(54,	1,	660000000U),
PLLVIDEO0(27,	0,	672000000U),
PLLVIDEO0(56,	1,	684000000U),
PLLVIDEO0(28,	0,	696000000U),
PLLVIDEO0(58,	1,	708000000U),
PLLVIDEO0(29,	0,	720000000U),
PLLVIDEO0(60,	1,	732000000U),
PLLVIDEO0(30,	0,	744000000U),
PLLVIDEO0(62,	1,	756000000U),
PLLVIDEO0(31,	0,	768000000U),
PLLVIDEO0(64,	1,	780000000U),
PLLVIDEO0(32,	0,	792000000U),
PLLVIDEO0(66,	1,	804000000U),
PLLVIDEO0(33,	0,	816000000U),
PLLVIDEO0(68,	1,	828000000U),
PLLVIDEO0(34,	0,	840000000U),
PLLVIDEO0(70,	1,	852000000U),
PLLVIDEO0(35,	0,	864000000U),
PLLVIDEO0(72,	1,	876000000U),
PLLVIDEO0(36,	0,	888000000U),
PLLVIDEO0(74,	1,	900000000U),
PLLVIDEO0(37,	0,	912000000U),
PLLVIDEO0(76,	1,	924000000U),
PLLVIDEO0(38,	0,	936000000U),
PLLVIDEO0(78,	1,	948000000U),
PLLVIDEO0(39,	0,	960000000U),
PLLVIDEO0(80,	1,	972000000U),
PLLVIDEO0(40,	0,	984000000U),
PLLVIDEO0(82,	1,	996000000U),
PLLVIDEO0(41,	0,	1008000000U),
PLLVIDEO0(84,	1,	1020000000U),
PLLVIDEO0(42,	0,	1032000000U),
PLLVIDEO0(86,	1,	1044000000U),
PLLVIDEO0(43,	0,	1056000000U),
PLLVIDEO0(88,	1,	1068000000U),
PLLVIDEO0(44,	0,	1080000000U),
PLLVIDEO0(90,	1,	1092000000U),
PLLVIDEO0(45,	0,	1104000000U),
PLLVIDEO0(92,	1,	1116000000U),
PLLVIDEO0(46,	0,	1128000000U),
PLLVIDEO0(94,	1,	1140000000U),
PLLVIDEO0(47,	0,	1152000000U),
PLLVIDEO0(96,	1,	1164000000U),
PLLVIDEO0(48,	0,	1176000000U),
PLLVIDEO0(98,	1,	1188000000U),
PLLVIDEO0(49,	0,	1200000000U),
PLLVIDEO0(100,	1,	1212000000U),
PLLVIDEO0(50,	0,	1224000000U),
PLLVIDEO0(102,	1,	1236000000U),
PLLVIDEO0(51,	0,	1248000000U),
PLLVIDEO0(104,	1,	1260000000U),
PLLVIDEO0(52,	0,	1272000000U),
PLLVIDEO0(106,	1,	1284000000U),
PLLVIDEO0(53,	0,	1296000000U),
PLLVIDEO0(108,	1,	1308000000U),
PLLVIDEO0(54,	0,	1320000000U),
PLLVIDEO0(110,	1,	1332000000U),
PLLVIDEO0(55,	0,	1344000000U),
PLLVIDEO0(112,	1,	1356000000U),
PLLVIDEO0(56,	0,	1368000000U),
PLLVIDEO0(114,	1,	1380000000U),
PLLVIDEO0(57,	0,	1392000000U),
PLLVIDEO0(116,	1,	1404000000U),
PLLVIDEO0(58,	0,	1416000000U),
PLLVIDEO0(118,	1,	1428000000U),
PLLVIDEO0(59,	0,	1440000000U),
PLLVIDEO0(120,	1,	1452000000U),
PLLVIDEO0(60,	0,	1464000000U),
PLLVIDEO0(122,	1,	1476000000U),
PLLVIDEO0(61,	0,	1488000000U),
PLLVIDEO0(124,	1,	1500000000U),
PLLVIDEO0(62,	0,	1512000000U),
PLLVIDEO0(126,	1,	1524000000U),
PLLVIDEO0(63,	0,	1536000000U),
PLLVIDEO0(128,	1,	1548000000U),
PLLVIDEO0(64,	0,	1560000000U),
PLLVIDEO0(130,	1,	1572000000U),
PLLVIDEO0(65,	0,	1584000000U),
PLLVIDEO0(132,	1,	1596000000U),
PLLVIDEO0(66,	0,	1608000000U),
PLLVIDEO0(134,	1,	1620000000U),
PLLVIDEO0(67,	0,	1632000000U),
PLLVIDEO0(136,	1,	1644000000U),
PLLVIDEO0(68,	0,	1656000000U),
PLLVIDEO0(138,	1,	1668000000U),
PLLVIDEO0(69,	0,	1680000000U),
PLLVIDEO0(140,	1,	1692000000U),
PLLVIDEO0(70,	0,	1704000000U),
PLLVIDEO0(142,	1,	1716000000U),
PLLVIDEO0(71,	0,	1728000000U),
PLLVIDEO0(144,	1,	1740000000U),
PLLVIDEO0(72,	0,	1752000000U),
PLLVIDEO0(146,	1,	1764000000U),
PLLVIDEO0(73,	0,	1776000000U),
PLLVIDEO0(148,	1,	1788000000U),
PLLVIDEO0(74,	0,	1800000000U),
PLLVIDEO0(150,	1,	1812000000U),
PLLVIDEO0(75,	0,	1824000000U),
PLLVIDEO0(152,	1,	1836000000U),
PLLVIDEO0(76,	0,	1848000000U),
PLLVIDEO0(154,	1,	1860000000U),
PLLVIDEO0(77,	0,	1872000000U),
PLLVIDEO0(156,	1,	1884000000U),
PLLVIDEO0(78,	0,	1896000000U),
PLLVIDEO0(158,	1,	1908000000U),
PLLVIDEO0(79,	0,	1920000000U),
PLLVIDEO0(160,	1,	1932000000U),
PLLVIDEO0(80,	0,	1944000000U),
PLLVIDEO0(162,	1,	1956000000U),
PLLVIDEO0(81,	0,	1968000000U),
PLLVIDEO0(164,	1,	1980000000U),
PLLVIDEO0(82,	0,	1992000000U),
PLLVIDEO0(166,	1,	2004000000U),
PLLVIDEO0(83,	0,	2016000000U),
PLLVIDEO0(168,	1,	2028000000U),
PLLVIDEO0(84,	0,	2040000000U),
PLLVIDEO0(170,	1,	2052000000U),
PLLVIDEO0(85,	0,	2064000000U),
PLLVIDEO0(172,	1,	2076000000U),
PLLVIDEO0(86,	0,	2088000000U),
PLLVIDEO0(174,	1,	2100000000U),
PLLVIDEO0(87,	0,	2112000000U),
PLLVIDEO0(176,	1,	2124000000U),
PLLVIDEO0(88,	0,	2136000000U),
PLLVIDEO0(178,	1,	2148000000U),
PLLVIDEO0(89,	0,	2160000000U),
PLLVIDEO0(180,	1,	2172000000U),
PLLVIDEO0(90,	0,	2184000000U),
PLLVIDEO0(182,	1,	2196000000U),
PLLVIDEO0(91,	0,	2208000000U),
PLLVIDEO0(184,	1,	2220000000U),
PLLVIDEO0(92,	0,	2232000000U),
PLLVIDEO0(186,	1,	2244000000U),
PLLVIDEO0(93,	0,	2256000000U),
PLLVIDEO0(188,	1,	2268000000U),
PLLVIDEO0(94,	0,	2280000000U),
PLLVIDEO0(190,	1,	2292000000U),
PLLVIDEO0(95,	0,	2304000000U),
PLLVIDEO0(192,	1,	2316000000U),
PLLVIDEO0(96,	0,	2328000000U),
PLLVIDEO0(194,	1,	2340000000U),
PLLVIDEO0(97,	0,	2352000000U),
PLLVIDEO0(196,	1,	2364000000U),
PLLVIDEO0(98,	0,	2376000000U),
PLLVIDEO0(198,	1,	2388000000U),
PLLVIDEO0(99,	0,	2400000000U),
PLLVIDEO0(200,	1,	2412000000U),
PLLVIDEO0(100,	0,	2424000000U),
PLLVIDEO0(202,	1,	2436000000U),
PLLVIDEO0(101,	0,	2448000000U),
PLLVIDEO0(204,	1,	2460000000U),
PLLVIDEO0(102,	0,	2472000000U),
PLLVIDEO0(206,	1,	2484000000U),
PLLVIDEO0(103,	0,	2496000000U),
PLLVIDEO0(208,	1,	2508000000U),
PLLVIDEO0(104,	0,	2520000000U),
};

/* PLLVIDEO1(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllvideo1x4_tbl[] = {
PLLVIDEO1(23,	1,	288000000U),
PLLVIDEO1(24,	1,	300000000U),
PLLVIDEO1(25,	1,	312000000U),
PLLVIDEO1(26,	1,	324000000U),
PLLVIDEO1(27,	1,	336000000U),
PLLVIDEO1(28,	1,	348000000U),
PLLVIDEO1(29,	1,	360000000U),
PLLVIDEO1(30,	1,	372000000U),
PLLVIDEO1(31,	1,	384000000U),
PLLVIDEO1(32,	1,	396000000U),
PLLVIDEO1(33,	1,	408000000U),
PLLVIDEO1(34,	1,	420000000U),
PLLVIDEO1(35,	1,	432000000U),
PLLVIDEO1(36,	1,	444000000U),
PLLVIDEO1(18,	0,	456000000U),
PLLVIDEO1(38,	1,	468000000U),
PLLVIDEO1(19,	0,	480000000U),
PLLVIDEO1(40,	1,	492000000U),
PLLVIDEO1(20,	0,	504000000U),
PLLVIDEO1(42,	1,	516000000U),
PLLVIDEO1(21,	0,	528000000U),
PLLVIDEO1(44,	1,	540000000U),
PLLVIDEO1(22,	0,	552000000U),
PLLVIDEO1(46,	1,	564000000U),
PLLVIDEO1(23,	0,	576000000U),
PLLVIDEO1(48,	1,	588000000U),
PLLVIDEO1(24,	0,	600000000U),
PLLVIDEO1(50,	1,	612000000U),
PLLVIDEO1(25,	0,	624000000U),
PLLVIDEO1(52,	1,	636000000U),
PLLVIDEO1(26,	0,	648000000U),
PLLVIDEO1(54,	1,	660000000U),
PLLVIDEO1(27,	0,	672000000U),
PLLVIDEO1(56,	1,	684000000U),
PLLVIDEO1(28,	0,	696000000U),
PLLVIDEO1(58,	1,	708000000U),
PLLVIDEO1(29,	0,	720000000U),
PLLVIDEO1(60,	1,	732000000U),
PLLVIDEO1(30,	0,	744000000U),
PLLVIDEO1(62,	1,	756000000U),
PLLVIDEO1(31,	0,	768000000U),
PLLVIDEO1(64,	1,	780000000U),
PLLVIDEO1(32,	0,	792000000U),
PLLVIDEO1(66,	1,	804000000U),
PLLVIDEO1(33,	0,	816000000U),
PLLVIDEO1(68,	1,	828000000U),
PLLVIDEO1(34,	0,	840000000U),
PLLVIDEO1(70,	1,	852000000U),
PLLVIDEO1(35,	0,	864000000U),
PLLVIDEO1(72,	1,	876000000U),
PLLVIDEO1(36,	0,	888000000U),
PLLVIDEO1(74,	1,	900000000U),
PLLVIDEO1(37,	0,	912000000U),
PLLVIDEO1(76,	1,	924000000U),
PLLVIDEO1(38,	0,	936000000U),
PLLVIDEO1(78,	1,	948000000U),
PLLVIDEO1(39,	0,	960000000U),
PLLVIDEO1(80,	1,	972000000U),
PLLVIDEO1(40,	0,	984000000U),
PLLVIDEO1(82,	1,	996000000U),
PLLVIDEO1(41,	0,	1008000000U),
PLLVIDEO1(84,	1,	1020000000U),
PLLVIDEO1(42,	0,	1032000000U),
PLLVIDEO1(86,	1,	1044000000U),
PLLVIDEO1(43,	0,	1056000000U),
PLLVIDEO1(88,	1,	1068000000U),
PLLVIDEO1(44,	0,	1080000000U),
PLLVIDEO1(90,	1,	1092000000U),
PLLVIDEO1(45,	0,	1104000000U),
PLLVIDEO1(92,	1,	1116000000U),
PLLVIDEO1(46,	0,	1128000000U),
PLLVIDEO1(94,	1,	1140000000U),
PLLVIDEO1(47,	0,	1152000000U),
PLLVIDEO1(96,	1,	1164000000U),
PLLVIDEO1(48,	0,	1176000000U),
PLLVIDEO1(98,	1,	1188000000U),
PLLVIDEO1(49,	0,	1200000000U),
PLLVIDEO1(100,	1,	1212000000U),
PLLVIDEO1(50,	0,	1224000000U),
PLLVIDEO1(102,	1,	1236000000U),
PLLVIDEO1(51,	0,	1248000000U),
PLLVIDEO1(104,	1,	1260000000U),
PLLVIDEO1(52,	0,	1272000000U),
PLLVIDEO1(106,	1,	1284000000U),
PLLVIDEO1(53,	0,	1296000000U),
PLLVIDEO1(108,	1,	1308000000U),
PLLVIDEO1(54,	0,	1320000000U),
PLLVIDEO1(110,	1,	1332000000U),
PLLVIDEO1(55,	0,	1344000000U),
PLLVIDEO1(112,	1,	1356000000U),
PLLVIDEO1(56,	0,	1368000000U),
PLLVIDEO1(114,	1,	1380000000U),
PLLVIDEO1(57,	0,	1392000000U),
PLLVIDEO1(116,	1,	1404000000U),
PLLVIDEO1(58,	0,	1416000000U),
PLLVIDEO1(118,	1,	1428000000U),
PLLVIDEO1(59,	0,	1440000000U),
PLLVIDEO1(120,	1,	1452000000U),
PLLVIDEO1(60,	0,	1464000000U),
PLLVIDEO1(122,	1,	1476000000U),
PLLVIDEO1(61,	0,	1488000000U),
PLLVIDEO1(124,	1,	1500000000U),
PLLVIDEO1(62,	0,	1512000000U),
PLLVIDEO1(126,	1,	1524000000U),
PLLVIDEO1(63,	0,	1536000000U),
PLLVIDEO1(128,	1,	1548000000U),
PLLVIDEO1(64,	0,	1560000000U),
PLLVIDEO1(130,	1,	1572000000U),
PLLVIDEO1(65,	0,	1584000000U),
PLLVIDEO1(132,	1,	1596000000U),
PLLVIDEO1(66,	0,	1608000000U),
PLLVIDEO1(134,	1,	1620000000U),
PLLVIDEO1(67,	0,	1632000000U),
PLLVIDEO1(136,	1,	1644000000U),
PLLVIDEO1(68,	0,	1656000000U),
PLLVIDEO1(138,	1,	1668000000U),
PLLVIDEO1(69,	0,	1680000000U),
PLLVIDEO1(140,	1,	1692000000U),
PLLVIDEO1(70,	0,	1704000000U),
PLLVIDEO1(142,	1,	1716000000U),
PLLVIDEO1(71,	0,	1728000000U),
PLLVIDEO1(144,	1,	1740000000U),
PLLVIDEO1(72,	0,	1752000000U),
PLLVIDEO1(146,	1,	1764000000U),
PLLVIDEO1(73,	0,	1776000000U),
PLLVIDEO1(148,	1,	1788000000U),
PLLVIDEO1(74,	0,	1800000000U),
PLLVIDEO1(150,	1,	1812000000U),
PLLVIDEO1(75,	0,	1824000000U),
PLLVIDEO1(152,	1,	1836000000U),
PLLVIDEO1(76,	0,	1848000000U),
PLLVIDEO1(154,	1,	1860000000U),
PLLVIDEO1(77,	0,	1872000000U),
PLLVIDEO1(156,	1,	1884000000U),
PLLVIDEO1(78,	0,	1896000000U),
PLLVIDEO1(158,	1,	1908000000U),
PLLVIDEO1(79,	0,	1920000000U),
PLLVIDEO1(160,	1,	1932000000U),
PLLVIDEO1(80,	0,	1944000000U),
PLLVIDEO1(162,	1,	1956000000U),
PLLVIDEO1(81,	0,	1968000000U),
PLLVIDEO1(164,	1,	1980000000U),
PLLVIDEO1(82,	0,	1992000000U),
PLLVIDEO1(166,	1,	2004000000U),
PLLVIDEO1(83,	0,	2016000000U),
PLLVIDEO1(168,	1,	2028000000U),
PLLVIDEO1(84,	0,	2040000000U),
PLLVIDEO1(170,	1,	2052000000U),
PLLVIDEO1(85,	0,	2064000000U),
PLLVIDEO1(172,	1,	2076000000U),
PLLVIDEO1(86,	0,	2088000000U),
PLLVIDEO1(174,	1,	2100000000U),
PLLVIDEO1(87,	0,	2112000000U),
PLLVIDEO1(176,	1,	2124000000U),
PLLVIDEO1(88,	0,	2136000000U),
PLLVIDEO1(178,	1,	2148000000U),
PLLVIDEO1(89,	0,	2160000000U),
PLLVIDEO1(180,	1,	2172000000U),
PLLVIDEO1(90,	0,	2184000000U),
PLLVIDEO1(182,	1,	2196000000U),
PLLVIDEO1(91,	0,	2208000000U),
PLLVIDEO1(184,	1,	2220000000U),
PLLVIDEO1(92,	0,	2232000000U),
PLLVIDEO1(186,	1,	2244000000U),
PLLVIDEO1(93,	0,	2256000000U),
PLLVIDEO1(188,	1,	2268000000U),
PLLVIDEO1(94,	0,	2280000000U),
PLLVIDEO1(190,	1,	2292000000U),
PLLVIDEO1(95,	0,	2304000000U),
PLLVIDEO1(192,	1,	2316000000U),
PLLVIDEO1(96,	0,	2328000000U),
PLLVIDEO1(194,	1,	2340000000U),
PLLVIDEO1(97,	0,	2352000000U),
PLLVIDEO1(196,	1,	2364000000U),
PLLVIDEO1(98,	0,	2376000000U),
PLLVIDEO1(198,	1,	2388000000U),
PLLVIDEO1(99,	0,	2400000000U),
PLLVIDEO1(200,	1,	2412000000U),
PLLVIDEO1(100,	0,	2424000000U),
PLLVIDEO1(202,	1,	2436000000U),
PLLVIDEO1(101,	0,	2448000000U),
PLLVIDEO1(204,	1,	2460000000U),
PLLVIDEO1(102,	0,	2472000000U),
PLLVIDEO1(206,	1,	2484000000U),
PLLVIDEO1(103,	0,	2496000000U),
PLLVIDEO1(208,	1,	2508000000U),
PLLVIDEO1(104,	0,	2520000000U),
};

/* PLLVIDEO2(n, d1, freq)	F_N8X8_D1V1X1 */
struct sunxi_clk_factor_freq factor_pllvideo2_tbl[] = {
PLLVIDEO2(19,     1,     60000000U),
PLLVIDEO2(29,     1,     90000000U),
PLLVIDEO2(30,     1,     93000000U),
PLLVIDEO2(31,     1,     96000000U),
PLLVIDEO2(32,     1,     99000000U),
PLLVIDEO2(33,     1,     102000000U),
PLLVIDEO2(34,     1,     105000000U),
PLLVIDEO2(17,     0,     108000000U),
PLLVIDEO2(36,     1,     111000000U),
PLLVIDEO2(18,     0,     114000000U),
PLLVIDEO2(38,     1,     117000000U),
PLLVIDEO2(19,     0,     120000000U),
PLLVIDEO2(40,     1,     123000000U),
PLLVIDEO2(20,     0,     126000000U),
PLLVIDEO2(42,     1,     129000000U),
PLLVIDEO2(21,     0,     132000000U),
PLLVIDEO2(44,     1,     135000000U),
PLLVIDEO2(22,     0,     138000000U),
PLLVIDEO2(46,     1,     141000000U),
PLLVIDEO2(23,     0,     144000000U),
PLLVIDEO2(48,     1,     147000000U),
PLLVIDEO2(24,     0,     150000000U),
PLLVIDEO2(50,     1,     153000000U),
PLLVIDEO2(25,     0,     156000000U),
PLLVIDEO2(52,     1,     159000000U),
PLLVIDEO2(26,     0,     162000000U),
PLLVIDEO2(54,     1,     165000000U),
PLLVIDEO2(27,     0,     168000000U),
PLLVIDEO2(56,     1,     171000000U),
PLLVIDEO2(28,     0,     174000000U),
PLLVIDEO2(58,     1,     177000000U),
PLLVIDEO2(29,     0,     180000000U),
PLLVIDEO2(60,     1,     183000000U),
PLLVIDEO2(30,     0,     186000000U),
PLLVIDEO2(62,     1,     189000000U),
PLLVIDEO2(31,     0,     192000000U),
PLLVIDEO2(64,     1,     195000000U),
PLLVIDEO2(32,     0,     198000000U),
PLLVIDEO2(66,     1,     201000000U),
PLLVIDEO2(33,     0,     204000000U),
PLLVIDEO2(68,     1,     207000000U),
PLLVIDEO2(34,     0,     210000000U),
PLLVIDEO2(70,     1,     213000000U),
PLLVIDEO2(35,     0,     216000000U),
PLLVIDEO2(72,     1,     219000000U),
PLLVIDEO2(36,     0,     222000000U),
PLLVIDEO2(74,     1,     225000000U),
PLLVIDEO2(37,     0,     228000000U),
PLLVIDEO2(76,     1,     231000000U),
PLLVIDEO2(38,     0,     234000000U),
PLLVIDEO2(78,     1,     237000000U),
PLLVIDEO2(39,     0,     240000000U),
PLLVIDEO2(80,     1,     243000000U),
PLLVIDEO2(40,     0,     246000000U),
PLLVIDEO2(82,     1,     249000000U),
PLLVIDEO2(41,     0,     252000000U),
PLLVIDEO2(84,     1,     255000000U),
PLLVIDEO2(42,     0,     258000000U),
PLLVIDEO2(86,     1,     261000000U),
PLLVIDEO2(43,     0,     264000000U),
PLLVIDEO2(88,     1,     267000000U),
PLLVIDEO2(44,     0,     270000000U),
PLLVIDEO2(90,     1,     273000000U),
PLLVIDEO2(45,     0,     276000000U),
PLLVIDEO2(92,     1,     279000000U),
PLLVIDEO2(46,     0,     282000000U),
PLLVIDEO2(94,     1,     285000000U),
PLLVIDEO2(47,     0,     288000000U),
PLLVIDEO2(96,     1,     291000000U),
PLLVIDEO2(48,     0,     294000000U),
PLLVIDEO2(98,     1,     297000000U),
PLLVIDEO2(49,     0,     300000000U),
PLLVIDEO2(100,     1,     303000000U),
PLLVIDEO2(50,     0,     306000000U),
PLLVIDEO2(102,     1,     309000000U),
PLLVIDEO2(51,     0,     312000000U),
PLLVIDEO2(104,     1,     315000000U),
PLLVIDEO2(52,     0,     318000000U),
PLLVIDEO2(106,     1,     321000000U),
PLLVIDEO2(53,     0,     324000000U),
PLLVIDEO2(108,     1,     327000000U),
PLLVIDEO2(54,     0,     330000000U),
PLLVIDEO2(110,     1,     333000000U),
PLLVIDEO2(55,     0,     336000000U),
PLLVIDEO2(112,     1,     339000000U),
PLLVIDEO2(56,     0,     342000000U),
PLLVIDEO2(114,     1,     345000000U),
PLLVIDEO2(57,     0,     348000000U),
PLLVIDEO2(116,     1,     351000000U),
PLLVIDEO2(58,     0,     354000000U),
PLLVIDEO2(118,     1,     357000000U),
PLLVIDEO2(59,     0,     360000000U),
PLLVIDEO2(120,     1,     363000000U),
PLLVIDEO2(60,     0,     366000000U),
PLLVIDEO2(122,     1,     369000000U),
PLLVIDEO2(61,     0,     372000000U),
PLLVIDEO2(124,     1,     375000000U),
PLLVIDEO2(62,     0,     378000000U),
PLLVIDEO2(126,     1,     381000000U),
PLLVIDEO2(63,     0,     384000000U),
PLLVIDEO2(128,     1,     387000000U),
PLLVIDEO2(64,     0,     390000000U),
PLLVIDEO2(130,     1,     393000000U),
PLLVIDEO2(65,     0,     396000000U),
PLLVIDEO2(132,     1,     399000000U),
PLLVIDEO2(66,     0,     402000000U),
PLLVIDEO2(134,     1,     405000000U),
PLLVIDEO2(67,     0,     408000000U),
PLLVIDEO2(136,     1,     411000000U),
PLLVIDEO2(68,     0,     414000000U),
PLLVIDEO2(138,     1,     417000000U),
PLLVIDEO2(69,     0,     420000000U),
PLLVIDEO2(140,     1,     423000000U),
PLLVIDEO2(70,     0,     426000000U),
PLLVIDEO2(142,     1,     429000000U),
PLLVIDEO2(71,     0,     432000000U),
PLLVIDEO2(144,     1,     435000000U),
PLLVIDEO2(72,     0,     438000000U),
PLLVIDEO2(146,     1,     441000000U),
PLLVIDEO2(73,     0,     444000000U),
PLLVIDEO2(148,     1,     447000000U),
PLLVIDEO2(74,     0,     450000000U),
PLLVIDEO2(150,     1,     453000000U),
PLLVIDEO2(75,     0,     456000000U),
PLLVIDEO2(152,     1,     459000000U),
PLLVIDEO2(76,     0,     462000000U),
PLLVIDEO2(154,     1,     465000000U),
PLLVIDEO2(77,     0,     468000000U),
PLLVIDEO2(156,     1,     471000000U),
PLLVIDEO2(78,     0,     474000000U),
PLLVIDEO2(158,     1,     477000000U),
PLLVIDEO2(79,     0,     480000000U),
PLLVIDEO2(160,     1,     483000000U),
PLLVIDEO2(80,     0,     486000000U),
PLLVIDEO2(162,     1,     489000000U),
PLLVIDEO2(81,     0,     492000000U),
PLLVIDEO2(164,     1,     495000000U),
PLLVIDEO2(82,     0,     498000000U),
PLLVIDEO2(166,     1,     501000000U),
PLLVIDEO2(83,     0,     504000000U),
PLLVIDEO2(168,     1,     507000000U),
PLLVIDEO2(84,     0,     510000000U),
PLLVIDEO2(170,     1,     513000000U),
PLLVIDEO2(85,     0,     516000000U),
PLLVIDEO2(172,     1,     519000000U),
PLLVIDEO2(86,     0,     522000000U),
PLLVIDEO2(174,     1,     525000000U),
PLLVIDEO2(87,     0,     528000000U),
PLLVIDEO2(176,     1,     531000000U),
PLLVIDEO2(88,     0,     534000000U),
PLLVIDEO2(178,     1,     537000000U),
PLLVIDEO2(89,     0,     540000000U),
PLLVIDEO2(180,     1,     543000000U),
PLLVIDEO2(90,     0,     546000000U),
PLLVIDEO2(182,     1,     549000000U),
PLLVIDEO2(91,     0,     552000000U),
PLLVIDEO2(184,     1,     555000000U),
PLLVIDEO2(92,     0,     558000000U),
PLLVIDEO2(186,     1,     561000000U),
PLLVIDEO2(93,     0,     564000000U),
PLLVIDEO2(188,     1,     567000000U),
PLLVIDEO2(94,     0,     570000000U),
PLLVIDEO2(190,     1,     573000000U),
PLLVIDEO2(95,     0,     576000000U),
PLLVIDEO2(192,     1,     579000000U),
PLLVIDEO2(96,     0,     582000000U),
PLLVIDEO2(194,     1,     585000000U),
PLLVIDEO2(97,     0,     588000000U),
PLLVIDEO2(196,     1,     591000000U),
PLLVIDEO2(98,     0,     594000000U),
PLLVIDEO2(198,     1,     597000000U),
PLLVIDEO2(99,     0,     600000000U),
};

/* PLLVE(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllve_tbl[] = {
PLLVE(24,     0,     0,     600000000U),
};

/* PLLCOM(n, d1, d2, freq)	F_N8X8_D1V1X1_D2V0X1 */
struct sunxi_clk_factor_freq factor_pllcom_tbl[] = {
PLLCOM(16,     1,     1,     102000000U),
PLLCOM(20,     1,     1,     126000000U),
PLLCOM(23,     1,     1,     144000000U),
PLLCOM(12,     1,     0,     156000000U),
PLLCOM(14,     0,     1,     180000000U),
PLLCOM(35,     1,     1,     216000000U),
PLLCOM(39,     1,     1,     240000000U),
PLLCOM(20,     1,     0,     252000000U),
PLLCOM(44,     1,     1,     270000000U),
PLLCOM(45,     1,     1,     276000000U),
PLLCOM(48,     1,     1,     294000000U),
PLLCOM(24,     0,     1,     300000000U),
PLLCOM(50,     1,     1,     306000000U),
PLLCOM(25,     0,     1,     312000000U),
PLLCOM(27,     0,     1,     336000000U),
PLLCOM(58,     1,     1,     354000000U),
PLLCOM(29,     1,     0,     360000000U),
PLLCOM(60,     1,     1,     366000000U),
PLLCOM(30,     1,     0,     372000000U),
PLLCOM(31,     1,     0,     384000000U),
PLLCOM(64,     1,     1,     390000000U),
PLLCOM(32,     1,     0,     396000000U),
PLLCOM(66,     1,     1,     402000000U),
PLLCOM(33,     0,     1,     408000000U),
PLLCOM(34,     1,     0,     420000000U),
PLLCOM(17,     0,     0,     432000000U),
PLLCOM(36,     1,     0,     444000000U),
PLLCOM(18,     0,     0,     456000000U),
PLLCOM(76,     1,     1,     462000000U),
PLLCOM(38,     0,     1,     468000000U),
PLLCOM(78,     1,     1,     474000000U),
PLLCOM(19,     0,     0,     480000000U),
PLLCOM(80,     1,     1,     486000000U),
PLLCOM(40,     0,     1,     492000000U),
PLLCOM(82,     1,     1,     498000000U),
PLLCOM(20,     0,     0,     504000000U),
PLLCOM(84,     1,     1,     510000000U),
PLLCOM(42,     1,     0,     516000000U),
PLLCOM(86,     1,     1,     522000000U),
PLLCOM(21,     0,     0,     528000000U),
PLLCOM(88,     1,     1,     534000000U),
PLLCOM(44,     1,     0,     540000000U),
PLLCOM(90,     1,     1,     546000000U),
PLLCOM(22,     0,     0,     552000000U),
PLLCOM(92,     1,     1,     558000000U),
PLLCOM(46,     1,     0,     564000000U),
PLLCOM(94,     1,     1,     570000000U),
PLLCOM(23,     0,     0,     576000000U),
PLLCOM(96,     1,     1,     582000000U),
PLLCOM(48,     1,     0,     588000000U),
PLLCOM(98,     1,     1,     594000000U),
PLLCOM(24,     0,     0,     600000000U),
PLLCOM(100,     1,     1,     606000000U),
PLLCOM(50,     0,     1,     612000000U),
PLLCOM(102,     1,     1,     618000000U),
PLLCOM(25,     0,     0,     624000000U),
PLLCOM(104,     1,     1,     630000000U),
PLLCOM(52,     1,     0,     636000000U),
PLLCOM(106,     1,     1,     642000000U),
PLLCOM(26,     0,     0,     648000000U),
PLLCOM(108,     1,     1,     654000000U),
PLLCOM(54,     0,     1,     660000000U),
PLLCOM(110,     1,     1,     666000000U),
PLLCOM(27,     0,     0,     672000000U),
PLLCOM(112,     1,     1,     678000000U),
PLLCOM(56,     0,     1,     684000000U),
PLLCOM(114,     1,     1,     690000000U),
PLLCOM(28,     0,     0,     696000000U),
PLLCOM(116,     1,     1,     702000000U),
PLLCOM(58,     1,     0,     708000000U),
PLLCOM(118,     1,     1,     714000000U),
PLLCOM(29,     0,     0,     720000000U),
PLLCOM(120,     1,     1,     726000000U),
PLLCOM(60,     1,     0,     732000000U),
PLLCOM(122,     1,     1,     738000000U),
PLLCOM(30,     0,     0,     744000000U),
PLLCOM(124,     1,     1,     750000000U),
PLLCOM(62,     0,     1,     756000000U),
PLLCOM(126,     1,     1,     762000000U),
PLLCOM(31,     0,     0,     768000000U),
PLLCOM(128,     1,     1,     774000000U),
PLLCOM(64,     0,     1,     780000000U),
PLLCOM(130,     1,     1,     786000000U),
PLLCOM(32,     0,     0,     792000000U),
PLLCOM(132,     1,     1,     798000000U),
PLLCOM(66,     1,     0,     804000000U),
PLLCOM(134,     1,     1,     810000000U),
PLLCOM(33,     0,     0,     816000000U),
PLLCOM(136,     1,     1,     822000000U),
PLLCOM(68,     0,     1,     828000000U),
PLLCOM(138,     1,     1,     834000000U),
PLLCOM(34,     0,     0,     840000000U),
PLLCOM(140,     1,     1,     846000000U),
PLLCOM(70,     1,     0,     852000000U),
PLLCOM(142,     1,     1,     858000000U),
PLLCOM(35,     0,     0,     864000000U),
PLLCOM(144,     1,     1,     870000000U),
PLLCOM(72,     1,     0,     876000000U),
PLLCOM(146,     1,     1,     882000000U),
PLLCOM(36,     0,     0,     888000000U),
PLLCOM(148,     1,     1,     894000000U),
PLLCOM(74,     0,     1,     900000000U),
PLLCOM(150,     1,     1,     906000000U),
PLLCOM(37,     0,     0,     912000000U),
PLLCOM(152,     1,     1,     918000000U),
PLLCOM(76,     0,     1,     924000000U),
PLLCOM(154,     1,     1,     930000000U),
PLLCOM(38,     0,     0,     936000000U),
PLLCOM(156,     1,     1,     942000000U),
PLLCOM(78,     0,     1,     948000000U),
PLLCOM(158,     1,     1,     954000000U),
PLLCOM(39,     0,     0,     960000000U),
PLLCOM(160,     1,     1,     966000000U),
PLLCOM(80,     0,     1,     972000000U),
PLLCOM(162,     1,     1,     978000000U),
PLLCOM(40,     0,     0,     984000000U),
PLLCOM(164,     1,     1,     990000000U),
PLLCOM(82,     0,     1,     996000000U),
};

static unsigned int pllcpu_max, pllddr_max, pllperiph0_max, pllperiph1_max,
		    pllgpu_max, pllvideo0x4_max, pllvideo1x4_max, pllvideo2_max,
			pllve_max, pllcom_max;

#define PLL_MAX_ASSIGN(name) (pll##name##_max = \
	factor_pll##name##_tbl[ARRAY_SIZE(factor_pll##name##_tbl)-1].freq)

void sunxi_clk_factor_initlimits(void)
{
	PLL_MAX_ASSIGN(cpu);
	PLL_MAX_ASSIGN(ddr);
	PLL_MAX_ASSIGN(periph0);
	PLL_MAX_ASSIGN(periph1);
	PLL_MAX_ASSIGN(gpu);
	PLL_MAX_ASSIGN(video0x4);
	PLL_MAX_ASSIGN(video1x4);
	PLL_MAX_ASSIGN(video2);
	PLL_MAX_ASSIGN(ve);
	PLL_MAX_ASSIGN(com);
}
